package com.ihr360.oneclick.service;

import com.ihr360.oneclick.entity.Spreadsheet;
import com.ihr360.oneclick.entity.StaffRecord;
import com.ihr360.oneclick.modal.ExcelImportContext;
import com.ihr360.oneclick.request.SearchRequest;
import com.ihr360.oneclick.request.SpreadsheetImportRequest;
import com.ihr360.oneclick.vo.ExcelImportResult;

import java.io.OutputStream;
import java.util.List;

/**
 * @author tom
 * @date 18-1-4
 */
public interface ExcelHandlerService {


    /**
     * excel data 解析
     *
     * @param spreadsheetImportRequest
     * @return ExcelImportContext
     */
    ExcelImportContext excelDataParse(SpreadsheetImportRequest spreadsheetImportRequest);

    /**
     * 保存Excel Data
     *
     * @param excelImportContext ExcelImportContext
     * @return
     */
    ExcelImportResult saveExcelData(ExcelImportContext excelImportContext);

    /**
     * excel data 解析
     *
     * @param spreadsheetImportRequest
     * @return ExcelImportContext
     */
//    ExcelImportContext excelDataParse(SpreadsheetImportRequest spreadsheetImportRequest);

    /**
     * 保存excel data 到临时表
     *
     * @param excelImportContext
     * @return
     */
    ExcelImportResult saveExcelTempData(ExcelImportContext excelImportContext);

    /**
     * 保存Excel Data
     *
     * @param excelImportContext ExcelImportContext
     * @return
     */
//    Spreadsheet saveExcelData(ExcelImportContext excelImportContext);

    /**
     * 导入Excel模板
     *
     * @param termId OneClickTermDto.id
     * @param out    输出流
     */
    void excelImportTemplateDownLoad(String termId, String templateType, OutputStream out);

    /**
     * 导出电子表格数据
     *
     * @param spreadsheetId SpreadSheetDto.id
     * @param rowIdList     行Id
     * @param out           输出流
     */
    void spreadsheetDataToExcelFile(String spreadsheetId, List<String> rowIdList, OutputStream out);

    /**
     * 导出员工名录
     */
    void staffRecordDataToExcelFile(SearchRequest searchRequest, List<String> idList, OutputStream out, String companyId);

    /**
     * 获取excel 导入的员工名录
     *
     * @param spreadsheet
     * @return
     */
    List<StaffRecord> getExcelImportStaffList(Spreadsheet spreadsheet);


    Spreadsheet saveExcelData(String userId, Spreadsheet spreadsheet, List<StaffRecord> staffRecordList);

    /**
     * 取消保存
     *
     * @param spreadsheetId
     * @return
     */
    Spreadsheet cancelSaveExcelData(String spreadsheetId);

    /**
     * 删除 草稿row
     *
     * @param spreadsheetId
     * @param idList
     * @return
     */
    Spreadsheet deleteTempExcelRow(String spreadsheetId, List<String> idList);

    /**
     * 删除所有草稿
     *
     * @param spreadsheetId
     * @return
     */
    Spreadsheet deleteTempExcelRowAll(String spreadsheetId);

}
